<template>
  <a-modal
    :visible="visible"
    :title="editId ? '院系信息修改' : '新增院系信息'"
    :confirmLoading="confirmLoading"
    okText='保存'
    :width="700"
    @cancel="() => { $emit('cancel') }"
    @ok="() => { $emit('create') }"
  >
    <a-form :form="form">
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item
            label="单位号"
            :labelCol="{span: 7,offset: 1}"
            :wrapperCol="{span: 15, offset: 1}"
          >
            <a-input v-decorator="[
              'dwh',
              {
                rules: [{ required: true, message: '请输入单位号!' }],
              }
            ]"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item
            label="单位名称"
            :labelCol="{span: 7,offset: 1}"
            :wrapperCol="{span: 15, offset: 1}"
          >
            <a-input v-decorator="[
              'dwmc',
              {
                rules: [{ required: true, message: '请输入单位名称!' }],
              }
            ]"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="单位英文名称" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-input v-decorator="['dwywmc']"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label="单位简称" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-input v-decorator="['dwjc']"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="单位英文简称" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-input v-decorator="['dwywjc']"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label="单位简拼" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-input v-decorator="['dwjp']"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="单位地址" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-input v-decorator="['dwdz']"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label="隶属单位号" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-input v-decorator="['lsdwh']"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="单位办别码" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-select v-decorator="['dwbbm']">
              <a-select-option v-for="i in selectMenu.dwbb" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label="单位类别码" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-select v-decorator="['dwlbm',
              {
                rules: [{ required: true, message: '请选择单位类别码!' }],
              }]">
              <a-select-option v-for="i in selectMenu.dwlb" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="单位有效标识" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-select v-decorator="['dwyxbs',
              {
                rules: [{ required: true, message: '请选择单位有效标识!' }],
              }]">
              <a-select-option :value="'1'">有效</a-select-option>
              <a-select-option :value="'0'">无效</a-select-option>
            </a-select>
            <!-- <a-input v-decorator="['dwyxbs',
              {
                rules: [{ required: true, message: '请输入单位有效标识!' }],
              }]"/> -->
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label="失效日期" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-date-picker v-decorator="['sxrq']" style="width: 100%" />
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="建立年月" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-date-picker v-decorator="['jlny']" style="width: 100%" />
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label="单位负责人号" :labelCol="{span: 7,offset: 1}" :wrapperCol="{span: 15, offset: 1}">
            <a-input v-decorator="['dwfzrh']"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item>
            <a-checkbox v-decorator="['sssfbz']" :checked="form.getFieldsValue().sssfbz">本年度硕士招生</a-checkbox>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item>
            <a-checkbox v-decorator="['bssfbz']" :checked="form.getFieldsValue().bssfbz">本年度博士招生</a-checkbox>
          </a-form-item>
        </a-col>
      </a-row>
      <a-form-item label="备注" :labelCol="{span: 2}" :wrapperCol="{span: 21, offset: 1}">
        <a-input type="textarea" v-decorator="['note']" :autosize="{ minRows: 2, maxRows: 6 }"/>
      </a-form-item>
    </a-form>
  </a-modal>
</template>

<script>
export default {
  props: ['visible', 'editId', 'selectMenu', 'confirmLoading'],
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  methods: {
  }
}
</script>

<style>

</style>
